﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using WinForms = System.Windows.Forms;

namespace HotelSoftBusClient
{
    /// <summary>
    /// MainWindow.xaml 的交互逻辑
    /// </summary>
    public partial class MainWindow : Window
    {
        WinForms.NotifyIcon Ntf;

        public MainWindow()
        {
            InitializeComponent();
            Loaded += MainWindow_Loaded;
            this.Hide();
            this.Closing += MainWindow_Closing;

            InitNtf();
        }

        void MainWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            e.Cancel = true;
            this.Hide();
            this.ShowInTaskbar = false;
        }

        private void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            
        }

        public void InitNtf()
        {
            this.Ntf = new WinForms.NotifyIcon();
            this.Ntf.BalloonTipText = "一卡通基础平台客户端";
            this.Ntf.Text = "一卡通基础平台客户端";
            this.Ntf.Icon = new System.Drawing.Icon("hotelSoftbusClient.ico");
            this.Ntf.Visible = true;
            //Ntf.MouseDoubleClick += OnNotifyIconDoubleClick;
            //this.Ntf.ShowBalloonTip(500);  
        }

        private void OnNotifyIconDoubleClick(object sender, WinForms.MouseEventArgs e)
        {
            this.Show();
        }

    }
}
